#ifndef WIFI_AT_H
#define WIFI_AT_H

#include "wifi_includes.h"

// WIFI模块的WIFI功能AT指令
#define WIFI_AT_CWMODE_CUR "AT+CWMODE_CUR"           // 设置Wi-Fi模式(STA/AP/STA+AP),不不保存到Flash
#define WIFI_AT_CWMODE_DEF "AT+CWMODE_DEF"           // 设置Wi-Fi模式(STA/AP/STA+AP),保存到Flash
#define WIFI_AT_CWJAP_CUR "AT+CWJAP_CUR"             // 连接指定AP,不保存到Flash
#define WIFI_AT_CWJAP_DEF "AT+CWJAP_DEF"             // 连接指定AP,保存到Flash
#define WIFI_AT_CWLAPOPT "AT+CWLAPOPT="              // 设置AT+CWLAP指令扫描结果的属性
#define WIFI_AT_CWLAP "AT+CWLAP"                     // 扫描周围的AP信息
#define WIFI_AT_CWQAP "AT+CWQAP\r\n"                 // 断开与当前AP的连接
#define WIFI_AT_CWSAP_CUR "AT+CWSAP_CUR"             // 设置ESP8266 SoftAP参数,不保存到Flash
#define WIFI_AT_CWSAP_DEF "AT+CWSAP_DEF"             // 设置ESP8266 SoftAP参数,保存到Flash
#define WIFI_AT_CWLIF "AT+CWLIF\r\n"                 // 获取连接到ESP8266 SoftAP的station的信息
#define WIFI_AT_CWDHCP_CUR "AT+CWDHCP_CUR"           // 设置ESP8266 SoftAP的DHCP参数,不保存到Flash
#define WIFI_AT_CWDHCP_DEF "AT+CWDHCP_DEF"           // 设置ESP8266 SoftAP的DHCP参数,保存到Flash
#define WIFI_AT_CWDHCPS_CUR "AT+CWDHCPS_CUR"         // 设置ESP8266 SoftAP DHCP分配的IP范围，不保存到Flash
#define WIFI_AT_CWDHCPS_DEF "AT+CWDHCPS_DEF"         // 设置ESP8266 SoftAP DHCP分配的IP范围，保存到Flash
#define WIFI_AT_CWAUTOCONN "AT+CWAUTOCONN="          // 设置上电时是否⾃自动连接AP
#define WIFI_AT_CIPSTAMAC_CUR "AT+CIPSTAMAC_CUR"     // 设置ESP8266 Station的MAC地址，不保存到Flash
#define WIFI_AT_CIPSTAMAC_DEF "AT+CIPSTAMAC_DEF"     // 设置ESP8266 Station的MAC地址，保存到Flash
#define WIFI_AT_CIPAPMAC_CUR "AT+CIPAPMAC_CUR"       // 设置ESP8266 SoftAP的MAC地址，不保存到Flash
#define WIFI_AT_CIPAPMAC_DEF "AT+CIPAPMAC_DEF"       // 设置ESP8266 SoftAP的MAC地址，保存到Flash
#define WIFI_AT_CIPSTA_CUR "AT+CIPSTA_CUR"           // 设置ESP8266 Station的IP地址，不保存到Flash
#define WIFI_AT_CIPSTA_DEF "AT+CIPSTA_DEF"           // 设置ESP8266 Station的IP地址，保存到Flash
#define WIFI_AT_CIPAP_CUR "AT+CIPAP_CUR"             // 设置ESP8266 SoftAP的IP地址，不保存到Flash
#define WIFI_AT_CIPAP_DEF "AT+CIPAP_DEF"             // 设置ESP8266 SoftAP的IP地址，保存到Flash
#define WIFI_AT_CWSTARTSMART "AT+CWSTARTSMART"       // 开始SmartConfig
#define WIFI_AT_CWSTOPSMART "AT+CWSTOPSMART"         // 停止SmartConfig
#define WIFI_AT_CWSTARTDISCOVER "AT+CWSTARTDISCOVER" // 开启可被局域⽹网内的微信探测的模式
#define WIFI_AT_CWSTOPDISCOVER "AT+CWSTOPDISCOVER"   // 关闭可被局域⽹网内的微信探测的模式
#define WIFI_AT_WPS "AT+WPS"                         // 设置WPS功能
#define WIFI_AT_MDNS "AT+MDNS"                       // 设置MDNS功能
#define WIFI_AT_CWHOSTNAME "AT+CWHOSTNAME="          // 设置ESP8266的主机名称
#define WIFI_AT_CWCOUNTRY_CUR "AT+CWCOUNTRY_CUR"     // 设置ESP8266当前WIFI国家码
#define WIFI_AT_CWCOUNTRY_DEF "AT+CWCOUNTRY_DEF"     // 设置ESP8266默认WIFI国家码

// 函数实现
void moduleCWMODE(uint8_t cmdType, uint8_t saveType, char *mode);
void moduleCWJAP_CUR(uint8_t cmdType, uint8_t saveType, char *ssid, char *pwd, char *bssid, char *pci_en);
void moduleCWLAPOPT(char *sort_enable, char *mask);
void moduleCWLAP(char *ssid, char *mac, char *channel, char *scan_type, char *scan_time_min, char *scan_time_max, uint8_t cmdType);
void moduleCWSAP(char *ssid, char *pwd, char *chl, char *ecn, char *max_conn, char *ssid_hidden, uint8_t cmdType, uint8_t saveType);
void moduleCWDHCP(char *mode, char *en, uint8_t cmdType, uint8_t saveType);
void moduleCWDHCPS(char *enable, char *leaseTime, char *startIP, char *endIP, uint8_t cmdType, uint8_t saveType);
void moduleCWAUTOCONN(char *enable);
void moduleCIPSTAMAC(char *mac, uint8_t cmdType, uint8_t saveType);
void moduleCIPAPMAC(char *mac, uint8_t cmdType, uint8_t saveType);
void moduleCIPSTA(char *ip, char *gateway, char *netmask, uint8_t cmdType, uint8_t saveType);
void moduleCIPAP(char *ip, char *gateway, char *netmask, uint8_t cmdType, uint8_t saveType);
void moduleCWSMART(char *type, uint8_t stopFlag);
void moduleCWDISCOVER(char *WeChatNumber, char *devType, char *time, uint8_t stopFlag);
void moduleWPS(char *enable);
void moduleMDNS(char *enable, char *hostname, char *serverName, char *serverPort);
void moduleCWHOSTNAME(char *hostName);
void moduleCWCOUNTRY(char *countryPolicy, char *countryCode, char *startChannel, char *totalChannelNumber, char cmdType, char saveType);

#endif